package com.zhongwang.mms.module.allocation.dao;

import com.zhongwang.mms.gen.entity.AllocationOrderDetail;
import com.zhongwang.mms.gen.entity.AllocationOrderDetailExample;
import com.zhongwang.mms.module.allocation.model.AllocationOrderModel;
import com.zhongwang.mms.module.half.model.HOrderDetailModel;
import com.zhongwang.mms.module.material.model.MOrderDetailModel;
import com.zhongwang.mms.module.purchase.model.POrderDetail;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AllocationOrderDetailDao {
    long countByExample(AllocationOrderDetailExample example);

    int deleteByExample(AllocationOrderDetailExample example);

    int deleteByPrimaryKey(Integer ardId);

    int insert(AllocationOrderDetail record);

    int insertSelective(AllocationOrderDetail record);

    List<AllocationOrderDetail> selectByExample(AllocationOrderDetailExample example);

    AllocationOrderDetail selectByPrimaryKey(Integer ardId);

    int updateByExampleSelective(@Param("record") AllocationOrderDetail record, @Param("example") AllocationOrderDetailExample example);

    int updateByExample(@Param("record") AllocationOrderDetail record, @Param("example") AllocationOrderDetailExample example);

    int updateByPrimaryKeySelective(AllocationOrderDetail record);

    int updateByPrimaryKey(AllocationOrderDetail record);

    List<AllocationOrderModel> selectAllByArdOderId(Integer ardOdrId);

    /**根据调拨主单ID查询明细*/
    List<AllocationOrderModel> selectOrderDetailByOdrId(Integer ardOdrId);

    /**根据主单ID查询调拨明细  返回外购件实体类 数量为ardOutNum*/
    List<POrderDetail> selectPurDetailByOdrId(Integer odrId);
    /**根据主单ID查询调拨明细  返回原料实体类*/
    List<MOrderDetailModel> selectMatDetailByOdrId(Integer odrId);

    /**调拨查询页面数据*/
    List<AllocationOrderModel> selectOrderDetailByQuery(AllocationOrderModel query);

    /**根据主单ID查询调拨明细  返回外购件实体类 数量为ardInNum*/
    List<POrderDetail> selectPurInDetailByOdrId(Integer odrId);

    /**根据主单ID查询调拨明细  返回成品库实体类 数量为ardInNum*/
    List<HOrderDetailModel> selectHalDetailByOdrId(Integer odrId);
}